<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    /**
     * 加入 "App" Namespace
     *
     */
    protected function _initApp()
    {
        $autoloader = Zend_Loader_Autoloader::getInstance();
        $autoloader->registerNamespace('App_');
    }

    /**
     * 初始化 Smarty
     *
     */
    protected function _initSmarty()
    {
        $view = new App_View_Smarty(array(
            'scriptPath' => APPLICATION_PATH . '/',
            'params' => array(
                'left_delimiter' => '<%',
                'right_delimiter' => '%>',
                'plugins_dir' => APPLICATION_PATH . '/lib/App/Smarty/plugins',
                'compile_dir' => APPLICATION_PATH . '/temp/compiled'
            ),
            'helperDirs' => array(
                'App/View/Helper' => 'App_View_Helper_',
                'Zend/View/Helper' => 'Zend_View_Helper_'
            ),
        ));

        // Controller Plugin
        Zend_Controller_Front::getInstance()->registerPlugin(new App_Controller_Plugin_ViewSetup());
        
        // View Renderer
        Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')
            ->setViewSuffix('tpl.htm')
            ->setView($view);
    }
}